<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button class="btn">只能点 3 次</button>
    <script src="jquery/jquery-3.6.1.js"></script>
    <script>
      let count = 0;
      $(".btn").click(incrment);

      let incrment = function () {
        console.log("功德 + 1");
        count++;
        if (count >= 3) {
          // 取消事件
          console.log("今天功德满了");
          $(".btn").off("click");
        }
      };
    </script>
  </body>
</html>
